package com.ddky.pophome;

import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

/**
 * description：
 * Author: 许少东
 * Created: 2/22/21 11:19 AM
 */
public class HomeFragment extends Fragment {
    private String homeTitle;
    private RecyclerView mRecyclerView;

    public HomeFragment(String title){
        homeTitle = title;
    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_home,container,false);
        mRecyclerView = view.findViewById(R.id.rv_home_list);
        setView();
        return view;
    }

    private void setView() {
        HomeAdapter homeAdapter = new HomeAdapter(getContext());
        GridLayoutManager gridLayoutManager = new GridLayoutManager(getContext(),2);
        mRecyclerView.setLayoutManager(gridLayoutManager);
        mRecyclerView.setAdapter(homeAdapter);
    }
}
